import 'package:device_info_plus/device_info_plus.dart';

class DeviceInfoUtil{
  static final DeviceInfoUtil _deviceUtil = DeviceInfoUtil._internal();
  DeviceInfoUtil._internal() {
    _deviceInfoPlugin = DeviceInfoPlugin();
  }
  factory DeviceInfoUtil() => _deviceUtil;
  static DeviceInfoUtil get instance => _deviceUtil;

  late DeviceInfoPlugin _deviceInfoPlugin;

  Future<AndroidDeviceInfo> get androidInfo => _deviceInfoPlugin.androidInfo;

  Future<IosDeviceInfo> get iosInfo => _deviceInfoPlugin.iosInfo;

  Map<String, dynamic> readAndroidBuildData(AndroidDeviceInfo build) {
    return <String, dynamic>{
      //'Manufacturer': build.manufacturer, //制造商
      'Model': build.model, //终端产品名称
      //'Brand': build.brand, //产品品牌
      // 'version.securityPatch': build.version.securityPatch,
      'Version.sdkInt': build.version.sdkInt,
      'Version.release': build.version.release,
      // 'Version.previewSdkInt': build.version.previewSdkInt,
      // 'Version.incremental': build.version.incremental,
      // 'version.codename': build.version.codename,
      //'version.baseOS': build.version.baseOS,
      // 'Board': build.board,
      //  'bootloader': build.bootloader,

      // 'device': build.device,
      //'display': build.display,
      //'fingerprint': build.fingerprint,
      //'hardware': build.hardware,
      //'host': build.host,
      //'id': build.id,
      // 'product': build.product,
      // 'supported32BitAbis': build.supported32BitAbis,
      // 'supported64BitAbis': build.supported64BitAbis,
      'SupportedAbis': build.supportedAbis,
      // 'tags': build.tags,
      // 'type': build.type,
      'isPhysicalDevice': build.isPhysicalDevice,
      // 'AndroidId': build.androidId,
      // 'systemFeatures': build.systemFeatures,
    };
  }

  Map<String, dynamic> readIosDeviceInfo(IosDeviceInfo data) {
    return <String, dynamic>{
      'Name': data.name,
      'SystemName': data.systemName,
      'SystemVersion': data.systemVersion,
      'Model': data.model,
      //'LocalizedModel': data.localizedModel,
      'IdentifierForVendor': data.identifierForVendor,
      'isPhysicalDevice': data.isPhysicalDevice,
//      'utsname.sysname:': data.utsname.sysname,
//      'utsname.nodename:': data.utsname.nodename,
//      'utsname.release:': data.utsname.release,
//      'utsname.version:': data.utsname.version,
      'utsname.machine:': data.utsname.machine,
    };
  }


}